#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int money = 0;
	int x = 0;
	int y = 0;
	int sum = 0;
	scanf("%d", &money);
	x = money;
	
	while (y!=1)
	{
		sum += x;
		y = x + y % 2;
		x = y / 2;
	}
	printf("%d\n", sum);
	return 0;
}